package com.laihui.adapters;

import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter;
import com.laihui.activity.R;
import com.laihui.entity.Article;
import com.laihui.utils.YXDate;

/**
 * Created by ST on 2017/7/24.
 */

public class ArticleAdapter extends RecyclerArrayAdapter<Article>{
    public ArticleAdapter(Context context) {
        super(context);
    }

    @Override
    public BaseViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) {
        return new  ArticleViewHoder(parent);
    }
    public class ArticleViewHoder extends BaseViewHolder<Article>{
        private TextView tv_name,tv_day/*,tv_content*/;
        public ArticleViewHoder(ViewGroup parent) {
            super(parent, R.layout.item_platform_announcement);
            tv_name = $(R.id.tv_name);
            tv_day = $(R.id.tv_day);

        }

        @Override
        public void setData(Article data) {
            super.setData(data);
            tv_name.setText(data.title);

            tv_day.setText( YXDate.TimeStamp2DateTime(data.updateTime));

        }
    }

}
